<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>渲染表格</title>
    <style>
        table{
            border-collapse: collapse;
            margin: 0 auto;
            text-align: center;
            line-height: 50px;
        }
        th{
            padding: 10px 20px;
        }
    </style>
</head>
<body>
    <script>
        let uname = prompt('请输入商品名称')
        let price = +prompt('请输入商品价格')
        let num = +prompt('请输入商品数量')
        let address = prompt('请输入收货地址')
        document.write(`
            <table border="1px">
                <caption>订单确认</caption>
                <tr>
                    <th>商品名称</th>
                    <th>商品价格</th>
                    <th>商品数量</th>
                    <th>总价</th>
                    <th>收货地址</th>
                </tr>
                <tr>
                    <td>${uname}</td>
                    <td>${price}元</td>
                    <td>${num}</td>
                    <td>${price*num}元</td>
                    <td>${address}</td>
                </tr>
            </table>
        `)
    </script>
</body>
</html>